package com.mrl.recursion;

/**
 * 使用递归解决阶乘问题
 *
 * @author 正义桑
 */
public class FactorialTest {
    public static void main(String[] args) {
        System.out.printf("%d! = %d",4 , factorial(4));
    }

    public static int factorial(int i) {
        if (i == 1) {
            return i;
        }
        return factorial(i - 1) * i;
    }
}
